﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.ComponentModel;

namespace MRadio.Model
{
    /// <summary>
    /// 收藏的频道
    /// </summary>
    public class FavoriteChannel:INotifyPropertyChanged
    {
        private string _channelName;
        private float _frequency;
        public Guid Id { get; set; }

        public FavoriteChannel()
        {
            Id = Guid.NewGuid();
            CretaeTime = DateTime.Now;
        }

        /// <summary>
        /// 频道名称。
        /// </summary>
        public string ChannelName
        {
            get { return _channelName; }
            set { _channelName = value; OnPropertyChange("ChannelName"); }
        }
        /// <summary>
        /// 频率
        /// </summary>
        public float Frequency
        {
            get { return _frequency; }
            set { _frequency = value; OnPropertyChange("Frequency"); }
        }

        public string FrequencyString
        {
            get
            {
                return string.Format("{0} MHZ",Frequency);
            }
        }
        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CretaeTime { get; set; }


        public event PropertyChangedEventHandler PropertyChanged;

        private void OnPropertyChange(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
}
